import { LinRouter, NotFound, disableLoading } from 'lin-mizar';
import { groupRequired } from '../../middleware/jwt';
import {
  BookSearchValidator,
  CreateOrUpdateBookValidator
} from '../../validator/book';
import { PositiveIdValidator } from '../../validator/common';

import { getSafeParamId } from '../../lib/util';
import { BookNotFound } from '../../lib/exception';
import { BookDao } from '../../dao/book';
//将数据写入文件中

var svgCaptcha = require('svg-captcha');

// book 的红图实例
const captchaApi = new LinRouter({
  prefix: '/v1/captcha',
  module: '验证码'
});


captchaApi.get('/', async ctx => {
  var captcha = svgCaptcha.create({
    inverse: false, // 翻转颜色
    fontSize: 48, // 字体大小
    noise: 2, // 噪声线条数
    width: 100, // 宽度
    height: 40, // 高度
    size: 4,// 验证码长度
    ignoreChars: '0o1i', // 验证码字符中排除 0o1i
  });
  ctx.json(captcha)
});



module.exports = { captchaApi, [disableLoading]: false };
